package com.echoesnet.echoesshortvideo.Repositories;

import com.echoesnet.echoesshortvideo.Api.HttpMethods;
import com.echoesnet.echoesshortvideo.Api.RequestHeader;
import com.echoesnet.echoesshortvideo.Constant.Api;

import java.util.Map;

import io.reactivex.Observer;

/**
 * Copyright (C) 2017 在线回声（天津）科技发展有限公司
 * 在线回声完全享有此软件的著作权，违者必究
 *
 * @author Administrator
 * @version 1.0
 * @modifier
 * @createDate 2018/4/25
 * @description
 */
public class SettingRepository
{

    public void postFeedBack(final String deviceId, String content, Observer<String> observer)
    {
        Map<String, Object> reqMap = RequestHeader.getCommonPartOfParam();
        reqMap.put(RequestHeader.DEVICE_TYPE, deviceId);
        reqMap.put(RequestHeader.CONTENT, content);
        HttpMethods.getInstance().startServerRequest(observer, Api.SYSTEMC_FEEDBACK, reqMap, true);
    }


    //设置页面
    public void getSettingState(Observer<String> observer)
    {
        Map<String, Object> reqMap = RequestHeader.getCommonPartOfParam();
        HttpMethods.getInstance().startServerRequest(observer, Api.SYSTEMC_SETTING, reqMap, true);
    }

    //通知开关
    public void changeNoticeState(String state, Observer<String> observer)
    {
        Map<String, Object> reqMap = RequestHeader.getCommonPartOfParam();
        reqMap.put(RequestHeader.VIDEO_DATA_DIRECTION, state);
        HttpMethods.getInstance().startServerRequest(observer, Api.SYSTEMC_NOTICE, reqMap, true);
    }


    //版本更新检查
    public void getVersionUpdate(String versionCode, String deviceId, Observer<String> observer)
    {
        Map<String, Object> reqMap = RequestHeader.getCommonPartOfParam();
        reqMap.put(RequestHeader.VERSION, versionCode);
        reqMap.put(RequestHeader.DEVICE_TYPE, deviceId);
        HttpMethods.getInstance().startServerRequest(observer, Api.SYSTEMC_VERSIONUPDATE, reqMap, true);
    }

    public void logout(Observer<String>observer)
    {
        Map<String, Object> reqMap = RequestHeader.getCommonPartOfParam();
        HttpMethods.getInstance().startServerRequest(observer,Api.LOGINC_LOGOUT,reqMap,true);
    }

}
